# 统计报表
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage
import uuid
import random


class Report(KeyWords):
    url = KeyWords.url + 'worksite/report'

    def report_screen(self):
        '''
        筛选工地列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\report\report_screen.yaml')
        element_operation(self, data[0]['data'])

    def report_search_by_name(self):
        '''
        根据项目名称搜索工地列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\report\report_search_by_name.yaml')
        element_operation(self, data[0]['data'])

    def report_search_by_address(self):
        '''
        根据地址搜索工地列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\report\report_search_by_address.yaml')
        element_operation(self, data[0]['data'])

    def report_search_by_encoding(self):
        '''
        根据项目编码搜索工地列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\report\report_search_by_encoding.yaml')
        element_operation(self, data[0]['data'])

    def report_search_by_error(self):
        '''
        根据项目编码搜索工地列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\site_manage\report\report_search_by_error.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    try:
        driver = choose_browser()
        L = LonginPage(driver)
        L.login('kobeAdmin002', 'kobe8888')
        case = Report(driver)
        case.report_search_by_address()
    except Exception as e:
        driver.quit()
        raise e
    else:
        driver.quit()
